<section class="title">
	<h4><?php echo lang('stoepje_prize_list_title'); ?></h4>
</section>

<section class="item">
	
	<?php if ($prizes): ?>

		<?php echo form_open('admin/voucher/prizes/delete'); ?>

		<table border="0" class="table-list">
			<thead>
			<tr>
				<th width="20"><?php echo form_checkbox(array('name' => 'action_to_all', 'class' => 'check-all')); ?></th>
				<th>&nbsp;</th>
				<th><?php echo lang('stoepje_prize_name_title'); ?></th>
				<th><?php echo lang('stoepje_prize_description_title'); ?></th>
				<th width="180"></th>
			</tr>
			</thead>
			<tfoot>
				<tr>
					<td colspan="5">
						<div class="inner"><?php $this->load->view('admin/partials/pagination'); ?></div>
					</td>
				</tr>
			</tfoot>
			<tbody>
				<?php $this->load->library('image_lib');?>
				<?php foreach ($prizes as $prize): ?>
				<tr>
					<td><?php echo form_checkbox('action_to[]', $prize->id); ?></td>
					<td>
					<?php
					if($prize->image){
						$this->image_lib->clear();
						$config['image_library'] = 'gd2';
						//$config['image_library'] = 'ImageMagick';
                		//$config['library_path'] = '/usr/bin/convert';
						$config['source_image'] = $imagePath.$prize->image;
						//$config['new_image'] = $banner->image;
						$config['create_thumb'] = TRUE;
						$config['maintain_ratio'] = TRUE;
						$config['width'] = $thumbWidth;
						$config['height'] = $thumbHeight;
						$this->image_lib->initialize($config);
						$this->image_lib->resize();
						//echo $this->image_lib->display_errors();
						
						$imageData = $this->image_lib->explode_name($prize->image);
					?>
						<a href="<?php echo site_url().$imageFolder.$prize->image?>" class="cboxElement media-photo" target="_blank" rel="group">
							<img src="<?php echo site_url().$imageFolder.$imageData['name'].'_thumb'.$imageData['ext'] ?>" />
						</a>
					<?php
					}
					?>
					</td>
					<td><?php echo $prize->name; ?></td>
					<td><?php echo $prize->description; ?></td>
					<td class="align-center buttons buttons-small">
						<?php echo anchor('admin/voucher/prizes/edit/' . $prize->id, lang('global:edit'), 'class="button edit"'); ?>
						<?php echo anchor('admin/voucher/prizes/delete/' . $prize->id, lang('global:delete'), 'class="confirm button delete"') ;?>
					</td>
				</tr>
				<?php endforeach; ?>
			</tbody>
		</table>

		<div class="table_action_buttons">
		<?php $this->load->view('admin/partials/buttons', array('buttons' => array('delete') )); ?>
		</div>

		<?php echo form_close(); ?>

	<?php else: ?>
		<div class="no_data"><?php echo lang('stoepje_prize_no_prize_title'); ?></div>
	<?php endif; ?>
</section>